package home.my.recordmanage.dao;

import home.my.base.dao.BaseDao;
import home.my.recordmanage.model.Style;

import org.hibernate.SQLQuery;
import org.hibernate.Session;

public class StyleDao extends BaseDao<Style> {

	//保存样式到数据库，只保存一个记录
	public void saveCurrentStyleToDb(String styleName) {
		Session s = this.getSession();
		SQLQuery q = s.createSQLQuery("delete from " + new Style().getTableName());
		q.executeUpdate();
		Style style = new Style();
		style.setId(1L);
		style.setName(styleName);
		s.save(style);
	}
}